/**
上传单张图片
*/
function swfSingleUpload(buttonId, successCallback, failCallback) {
	var bfUploadDefaultPoster;
	var settings = {
		flash_url: "https://res.sankai.com/st/klh_v1/swfupload/swfupload.swf",
		flash9_url: "https://res.sankai.com/st/klh_v1/swfupload/swfupload_fp9.swf",
		upload_url: "https://res.sankai.com/uploadservice/resource/imgUpload.do",
		file_size_limit: "4 MB",
		file_types: "*.jpg;*.gif;*.png",
		file_post_name: "myFile",
		post_params: {"lineType": "klh"},
		file_types_description: "myFile",
		file_upload_limit: 100,
		file_queue_limit: 100,
		debug: false,
		// Button settings
		button_action: SWFUpload.BUTTON_ACTION.SELECT_FILE,
		button_image_url: "https://res.sankai.com/st/klh_v1/img/uploadBtn.jpg",
		button_width: "102",
		button_height: "36",
		button_placeholder_id: buttonId,
		button_text: '',
		button_text_top_padding: 3,
						 
		file_dialog_complete_handler: function (numFilesSelected, numFilesQueued) {
			try {
				bfUploadDefaultPoster.startUpload()
			} catch (ex) {
				this.debug(ex);
			}
		},

		// 上传成功
		upload_success_handler: function (file, serverData) {
			var json = eval("(" + serverData + ")");
			successCallback(json);
		},
		
		// 上传失败
		file_queue_error_handler: function (file, errorCode, message) {
			failCallback(file, errorCode, message);
		}
		
	};
	bfUploadDefaultPoster = new SWFUpload(settings);
}
/**
上传多张图片
*/
function swfBatchUpload(buttonId, successCallback, failCallback) {
	var bfUploadDefaultPoster;
	var settings = {
		flash_url: "https://res.sankai.com/st/klh_v1/swfupload/swfupload.swf",
		flash9_url: "https://res.sankai.com/st/klh_v1/swfupload/swfupload_fp9.swf",
		upload_url: "https://res.sankai.com/uploadservice/resource/imgUpload.do",
		file_size_limit: "4 MB",
		file_types: "*.jpg;*.gif;*.png",
		file_post_name: "myFile",
		post_params: {"lineType": "klh"},
		file_types_description: "myFile",
		file_upload_limit: 100,
		file_queue_limit: 100,
		debug: false,
		// Button settings
		button_action: SWFUpload.BUTTON_ACTION.SELECT_FILES,
		button_image_url: "https://res.sankai.com/st/klh_v1/img/uploadBtn.jpg",
		button_width: "102",
		button_height: "36",
		button_placeholder_id: buttonId,
		button_text: '',
		button_text_top_padding: 3,
						 
		file_dialog_complete_handler: function (numFilesSelected, numFilesQueued) {
			try {
				bfUploadDefaultPoster.startUpload()
			} catch (ex) {
				this.debug(ex);
			}
		},

		//上传进度
		upload_progress_handler: function (file, curBytes, totalBytes) {
			var html = '图册'+file.name+'('+totalBytes+'KB)——已上传:'+curBytes+'KB——进度:'+(curBytes/totalBytes)*100+'%';
			$("#uploadProgress").html(html);	            
		},
		
		// 上传成功
		upload_success_handler: function (file, serverData) {
			var json = eval("(" + serverData + ")");
			successCallback(json);
		},
		
		// 上传失败
		file_queue_error_handler: function (file, errorCode, message) {
			failCallback(file, errorCode, message);
		}
		
	};
	bfUploadDefaultPoster = new SWFUpload(settings);
} 